<template>
    <view>
        <view class="cu-card dynamic" v-for="(item,index) in productList" :key="index">
            <view class="cu-item shadow">
                <view class="cu-list menu-avatar">
                    <view class="cu-item">
						 <view class="cu-avatar round lg">
							 <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar round lg" mode="widthFix">
						 </view>
                        <view class="content flex-sub">
                            <view>{{item.username}}</view>
                            <view class="text-gray text-sm flex justify-between">
                                {{item.createTime}}
                            </view>
                        </view>
                    </view>
                </view>
                <view class="text-content">
                    门牌号： {{item.dormitory}}
                </view>
                <view class="text-content">
                    电话号码： {{item.phoneNumber}}
                </view>

                <view class="text-content">
                    出行方式：{{item.traffic}}
                </view>
				<view class="text-content">
				    出行地点：{{item.address}}
				</view>
				<view class="text-content">
				    出行原因：{{item.reason}}
				</view>
				<view class="text-content">
				    行程路线：{{item.line}}
				</view>
				<view class="text-gray text-sm text-right padding">
                    <!-- <text class="cuIcon-attentionfill margin-lr-xs"></text> -->
                </view>
            </view>
        </view>
    </view>
</template>
<script>
	  import storage from '@/utils/storage'
	  import {listLeaveinfo} from '@/api/leave/leaveinfo'
	  
    export default {
        data() {
            return {
				
                isCard: false,
                productList: [{
						
						username: this.$store.state.user.name,
						dormitory: '',
						phoneNumber: '',
						reason: '',
						createTime: '',
						address: '',
						traffic: '',
						line: ''
						
                    },

                ],
            };
        },
		computed: {
		  avatar() {
		    return this.$store.state.user.avatar
		  },
		},
		created() {
			this.getCode()
		},
        methods: {

			getCode(){
				listLeaveinfo(this.name).then(res => {
					console.log(res)
					this.productList = res.rows.map((item) => {
						return {
							dormitory: item.dormitory,
							phoneNumber: item.phoneNumber,
							reason: item.reason,
							createTime: item.createTime,
							address: item.address,
							traffic: item.traffic,
							line: item.line,
						};
					});
				})
			},
			handleView(){
				this.$modal.showToast('模块建设中~')
			}
			
		}
    }
</script>
<style>
    .cu-card.dynamic>.cu-item>.text-content {
        margin-bottom: 1px;
        margin-top: 6px;
    }
</style>